/**
 * 
 */
package com.yst.metho.web.application.reports;

import nextapp.echo2.app.Component;
import nextapp.echo2.app.Label;
import nextapp.echo2.app.Table;
import nextapp.echo2.app.table.TableCellRenderer;

import com.yst.suivi.data.reports.Report;

/**
 * @author perso
 * 
 */
public class ReportTableCellRenderer implements TableCellRenderer
{

	private static final int NOM_COLUMN = 0;

	private static final int FILENAME_COLUMN = 1;

	/*
	 * (non-Javadoc)
	 * 
	 * @see nextapp.echo2.app.table.TableCellRenderer#getTableCellRendererComponent(nextapp.echo2.app.Table,
	 *      java.lang.Object, int, int)
	 */
	public Component getTableCellRendererComponent(Table table, Object value, int column, int row)
	{
		Report prj = (Report) value;
		Label label = new Label("");
		if (null != value)
		{
			switch (column)
			{
			case FILENAME_COLUMN:
				label.setText(prj.getFilename());
				break;
			case NOM_COLUMN:
				label.setText(prj.getNom());
				break;
			default:
				label.setText("colonne inconnu : " + column);
			}
		}
		else
		{
			label.setText("null");
		}
		if (row % 2 == 0)
		{
			label.setStyleName("ListingView.EvenRowLabel");
		}
		else
		{
			label.setStyleName("ListingView.OddRowLabel");
		}
		return label;
	}

}
